package org.hry.socket.bio.shortlink;


import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.stream.IntStream;

public class SocketClient {
    public static void main(String[] args) throws Exception {
        Socket socket = new Socket("localhost", 8888);

        // 如果需要给socketServer返回处理之后的数据，可以拿到输出流进行输出。
        OutputStream out = socket.getOutputStream();
        out.write("1|2|3|4|5".getBytes(StandardCharsets.UTF_8));
        // 关闭输出流，告诉服务端我写完数据了
        socket.shutdownOutput();
        System.out.println("数据发送完毕");
        socket.close();
    }
}
